package com.threedr3am.bug.spring.data.mongodb.controller;

import com.threedr3am.bug.spring.data.mongodb.repository.DemoRepository;
import java.util.List;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

  private final DemoRepository demoRepository;

  public DemoController(DemoRepository demoRepository) {
    this.demoRepository = demoRepository;
  }

  @RequestMapping(value = "/demo")
  public List<?> demo(@RequestParam(name = "keyword") String keyword) {
    return demoRepository.findAllByIdLike(keyword);
  }
}
